<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改考核合理性审核')" />
</head>
<body>
<form class="layui-form" th:object="${reportAssessmentRationality}">
    <div class="mainBox">
        <div class="main-container">
            <input name="id" th:field="*{id}" type="hidden">
    <div class="layui-form-item">
        <label class="layui-form-label">报告基本信息id：</label>
        <div class="layui-input-block">
            <input type="text" name="reportId" th:field="*{reportId}" placeholder="请输入报告基本信息id" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">课程目标的说明：</label>
        <div class="layui-input-block">
            <input type="text" name="courseExplan" th:field="*{courseExplan}" placeholder="请输入课程目标的说明" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">课程组审核意见：</label>
        <div class="layui-input-block">
            <input type="text" name="courseGroupAuditOpinion" th:field="*{courseGroupAuditOpinion}" placeholder="请输入课程组审核意见" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">专业审核意见：</label>
        <div class="layui-input-block">
            <input type="text" name="majorAuditOpinion" th:field="*{majorAuditOpinion}" placeholder="请输入专业审核意见" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题：</label>
        <div class="layui-input-block">
            <input type="text" name="title" th:field="*{title}" placeholder="请输入标题" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">毕业要求：</label>
        <div class="layui-input-block">
            <input type="text" name="graduationRequirements" th:field="*{graduationRequirements}" placeholder="请输入毕业要求" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">毕业要求指标点与课程目标JSON ：</label>
        <div class="layui-input-block">
            <input type="text" name="graduationRequirementsDetail" th:field="*{graduationRequirementsDetail}" placeholder="请输入毕业要求指标点与课程目标JSON " class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">课程目标：</label>
        <div class="layui-input-block">
            <input type="text" name="courseObjectives" th:field="*{courseObjectives}" placeholder="请输入课程目标" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试卷对应实体与分值JSON：</label>
        <div class="layui-input-block">
            <input type="text" name="scoreJson" th:field="*{scoreJson}" placeholder="请输入试卷对应实体与分值JSON" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试卷内容支撑：</label>
        <div class="layui-input-block">
            <input type="text" name="scoreContent" th:field="*{scoreContent}" placeholder="请输入试卷内容支撑" class="layui-input" />
        </div>
    </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="assessmentRationality-update">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
</body>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    layui.use(['form', 'jquery','laydate','dictionary'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let laydate = layui.laydate;

        let prefix = "/system/assessmentRationality/";

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
        form.on('submit(assessmentRationality-update)', function (data) {
            for(var key in data.field){
                var type=$(data.form).find("input[name='"+key+"']").attr("type");
                if(type=="checkbox"){
                    var value="";
                    $(data.form).find("input[name='"+key+"']:checked").each(function(){
                        value+=$(this).val()+",";
                    })
                    if(value!=""){
                        value=value.substr(0,value.length-1);
                        data.field[key]=value;
                    }

                }
            }
            $.ajax({
                url: prefix+'update',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'put',
                success: function (result) {
                    if (result.success) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                            parent.layui.table.reload("assessmentRationality-table");
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                    }
                }
            })
            return false;
        });
    });
</script>
</html>